package com.lantosec.hmrp.modules.sysdata.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.sysdata.vo.SysDataFormVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * <p>
 * 系统数据表单定义表 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-03-02
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysDataForm extends BaseEntity<SysDataFormVO> {

    private static final long serialVersionUID = 1L;
    /**
     * 数据表单ID
     */
    @TableId(value = "data_form_id", type = IdType.ASSIGN_UUID)
    private String dataFormId;
    /**
     * 数据表单名称
     */
    private String dataFormName;
    /**
     * 对应的数据模型ID
     */
    private String dataModelId;
    /**
     * 表单类型(1主表2从表)
     */
    private Integer dataFormType;
    /**
     * 表单布局JSON字符串
     */
    private String dataFormLayout;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 最后编辑时间
     */
    private Date editTime;

    public SysDataForm(SysDataFormVO vo) {
        this.dataFormId = vo.getDataFormId();
        this.dataFormName = vo.getDataFormName();
        this.dataModelId = vo.getDataModelId();
        this.dataFormType = vo.getDataFormType();
        this.dataFormLayout = vo.getDataFormLayout();
        this.createTime = vo.getCreateTime();
        this.editTime = vo.getEditTime();
    }

    @Override
    public SysDataFormVO convertToVO() {
        return new SysDataFormVO(this);
    }


    public enum ColName {
        data_form_id, data_form_name, data_model_id, data_form_type, data_form_layout, create_time, edit_time,
    }
}
